#include <stdio.h>
#include <unistd.h>

int main()
{
    pid_t pid = fork();
    if(pid < 0)
    {
        perror("fork");
        return 0;
    }
    else if(pid == 0)
    {
        //child
        printf("i am child,pid is %d,ppid is %d\n",getpid(),getppid());
    }
    else 
    {
        //father
        while(1)
        {
        printf("i am father,pid is %d,ppid is %d\n",getpid(),getppid());
        sleep(1);
        }
    }
    return 0;
}
